const mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/mytest', {
    useUnifiedTopology: true,
    useNewUrlParser: true
  }) //默认27017端口
  .then(() => console.log('success'))
  .catch(() => console.log('error'));